function Languages()
{
	this.constructor.prototype.autoLang = "Auto";
	this.constructor.prototype.autoCode = "";
	this.constructor.prototype.list = 
	[
		"Afrikaans",
		"Albanian",
		"Arabic",
		"Belarusian",
		"Bulgarian",
		"Catalan",
		"Chinese",
		"Croatian",
		"Czech",
		"Danish",
		"Dutch",
		"English",
		"Estonian",
		"Filipino",
		"Finnish",
		"French",
		"Galician",
		"German",
		"Greek",
		"Hebrew",
		"Hindi",
		"Hungarian",
		"Icelandic",
		"Indonesian",
		"Irish",
		"Italian",
		"Japanese",
		"Korean",
		"Latvian",
		"Lithuanian",
		"Macedonian",
		"Malay",
		"Maltese",
		"Norwegian",
		"Persian",
		"Polish",
		"Portuguese",
		"Romanian",
		"Russian",
		"Serbian",
		"Slovak",
		"Slovenian",
		"Spanish",
		"Swahili",
		"Swedish",
		"Thai",
		"Turkish",
		"Ukrainian",
		"Vietnamese",
		"Welsh",
		"Yiddish"
	];
	
	this.constructor.prototype.codeList = 
	[
		"af",
		"sq",
		"ar",
		"be",
		"bg",
		"ca",
		"zh",
		"hr",
		"cs",
		"da",
		"nl",
		"en",
		"et",
		"tl",
		"fi",
		"fr",
		"gl",
		"de",
		"el",
		"iw",
		"hi",
		"hu",
		"is",
		"id",
		"ga",
		"it",
		"ja",
		"ko",
		"lv",
		"lt",
		"mk",
		"ms",
		"mt",
		"no",
		"fa",
		"pl",
		"pt-PT",
		"ro",
		"ru",
		"sr",
		"sk",
		"sl",
		"es",
		"sw",
		"sv",
		"th",
		"tr",
		"uk",
		"vi",
		"cy",
		"yi"
	];
	
	this.constructor.prototype.codes = 
	{
		"Afrikaans": "af",
		"Albanian": "sq",
		"Arabic": "ar",
		"Belarusian": "be",
		"Bulgarian": "bg",
		"Catalan": "ca",
		"Chinese": "zh",
		"Croatian": "hr",
		"Czech": "cs",
		"Danish": "da",
		"Dutch": "nl",
		"English": "en",
		"Estonian": "et",
		"Filipino": "tl",
		"Finnish": "fi",
		"French": "fr",
		"Galician": "gl",
		"German": "de",
		"Greek": "el",
		"Hebrew": "iw",
		"Hindi": "hi",
		"Hungarian": "hu",
		"Icelandic": "is",
		"Indonesian": "id",
		"Irish": "ga",
		"Italian": "it",
		"Japanese": "ja",
		"Korean": "ko",
		"Latvian": "lv",
		"Lithuanian": "lt",
		"Macedonian": "mk",
		"Malay": "ms",
		"Maltese": "mt",
		"Norwegian": "no",
		"Persian": "fa",
		"Polish": "pl",
		"Portuguese": "pt-PT",
		"Romanian": "ro",
		"Russian": "ru",
		"Serbian": "sr",
		"Slovak": "sk",
		"Slovenian": "sl",
		"Spanish": "es",
		"Swahili": "sw",
		"Swedish": "sv",
		"Thai": "th",
		"Turkish": "tr",
		"Ukrainian": "uk",
		"Vietnamese": "vi",
		"Welsh": "cy",
		"Yiddish": "yi"
	};
	this.constructor.prototype.codes[this.autoLang] = this.autoCode;
}

function LangListGenerator()
{
	this.w = 85;
	this.h = 200;
	
	this.generate = function(id, type, callBack)
	{
		var container = this.createContainer(id);
		container.onclick = callBack;
		this.populateOptions(container, type, callBack);
	};
	
	this.constructor.prototype.createContainer = function(id)
	{
		var cont = document.createElement("div");
		cont.id = id;
		
		with (cont.style)
		{
			width = this.w + "px"
			height = this.h + "px";
			overflow = "auto";
			backgroundColor = "white";
			zIndex = "10";
			fontSize = "11px";
			fontFamily = "Arial, Helvetica, sans-serif";
			padding = "3px";
		}
		
		document.body.appendChild(cont);
		return cont;
	};
	
	this.constructor.prototype.populateOptions = function(cont, type)
	{
		if (type == "in")
			this.addOption(langs.autoLang, langs.autoCode, cont);
			
		for (var i = 0; i < langs.list.length; i++)
			this.addOption(langs.list[i], langs.codeList[i], cont);
	};
	
	this.constructor.prototype.addOption = function(langName, langCode, cont)
	{
		var opt = document.createElement("div");
		
		opt.className = "langItem";
		opt.id = langCode;
		opt.innerHTML = langName;
		
		cont.appendChild(opt);
	};
}

function LangButtons(inId, outId, imgPath, imgExt)
{
	this.inFlag = $(inId);
	this.outFlag = $(outId);
	this.imgPath = imgPath;
	this.imgExt = imgExt;
	
	this.constructor.prototype.setInFlag = function(langName)
	{
		if (langName.length == 0)
		{
			return;
		}
		this.inFlag.src = this.imgPath + langName + this.imgExt;
	}
	
	this.constructor.prototype.setOutFlag = function(langName)
	{
		if (langName.length == 0)
		{
			return;
		}
		this.outFlag.src = this.imgPath + langName + this.imgExt;
	}
	
	this.switchFlags = function()
	{
		var tmp = this.inFlag.src;
		this.inFlag.src = this.outFlag.src;
		this.outFlag.src = tmp;
	}
	
	this.setInFlag("English");
	this.setOutFlag("Russian");
}